/************************************************************************/
/*																		*/
/*		School Hangover Project											*/
/*																		*/
/*		IMAC 2010														*/
/*		Author : 	Helena Duchaussoy									*/
/*					Isabelle Gouwy										*/
/*					Nathalie Kuoch										*/
/*					Franck Letellier									*/
/*					Louise Pequignot									*/
/*																		*/
/*		E-mail: flo-in-underware@googlegroups.com						*/
/*																		*/
/************************************************************************/

#ifndef __STAGEMANAGER_H__
#define __STAGEMANAGER_H__

#include <cstdlib>
#include <map>
#include <string>
#include <osg/Group>
#include <osg/Geode>

#include "Singleton.h"

///Forward declaration save compilation time 
class AbstractStage;

class StageManager: public Singleton<StageManager> {

friend class Singleton<StageManager>;

protected:
	StageManager();
	virtual ~StageManager(){clear();}

public:
	void init();
	void update();
	///brief Get the stage you want
	AbstractStage* getStage(const std::string& sname); 

	///brief Load a stage into the manager
	bool loadStage(AbstractStage* pStage);

	///brief clear the whole Engine
	void clear();

	void setCurrentStage(const std::string& sname);


	///brief To know if the current strage is over
	bool isFinished();

	osg::Group* getRootNode();

	///brief return the current stage
	inline AbstractStage* getCurrentStage(){return m_pcurrentStage;}

private: 
    
	std::map<std::string, AbstractStage*> m_mstages;
	AbstractStage* m_pcurrentStage;


};

#endif //__STAGEMANAGER_H__
